package com.yonyou.crm.base.industry.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.yonyou.crm.base.industry.entity.IndustryVO;
import com.yonyou.crm.common.biz.service.BaseBizServiceImpl;
import com.yonyou.crm.common.page.entity.Page;

@Service
public class IndustryBizServiceImpl  extends BaseBizServiceImpl<IndustryVO> {
	
	//参照树
	public List<Map<String, Object>> getRefTree(){
		return dao.selectList(IndustryVO.class,"findIndustryTree");
	}
	
	public List<IndustryVO> getList(Map<String, Object> condMap) {
		if (condMap == null) {
			condMap = new HashMap<String, Object>();
		}
		List<IndustryVO> voList = dao.selectVoList(IndustryVO.class, "getList", condMap);
		return voList;
	}
	
	public Object selectFieldsByIds(Object[] ids) {
		Map<String, Object> para = new HashMap<String, Object>();
		para.put("ids", ids);
		return dao.selectList(IndustryVO.class, "selectFieldsByIds", para);
	}
	
	/*
	 * 获取参照档案列表
	 */
	public List<IndustryVO> getRefervaluesForApp(Page<IndustryVO> page, Map<String, Object> paraMap) {
		// TODO 加权限
		Page<IndustryVO> pageVO = dao.pageSelect(IndustryVO.class, page, "selectRefervalues", "countRefervalues", paraMap);
		List<IndustryVO> voList = pageVO.getData();
		return voList;
	}
	public IndustryVO getDetail(Long id,Long fatherId){
		Map<String, Object> para = new HashMap<String, Object>();
		para.put("id", id);
		para.put("father_id", fatherId);
		IndustryVO industryVO=(IndustryVO)dao.selectOne(IndustryVO.class, "getDetail", para);
		return industryVO;
	}
			
}
